function advm:skills/battery_swapper_detect

execute if score @s advm_battery_swapper_available matches 0 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:0b}].tag.power


execute if score @s advm_battery_swapper_available matches 1 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:1b}].tag.power


execute if score @s advm_battery_swapper_available matches 2 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:2b}].tag.power


execute if score @s advm_battery_swapper_available matches 3 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:3b}].tag.power


execute if score @s advm_battery_swapper_available matches 4 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:4b}].tag.power


execute if score @s advm_battery_swapper_available matches 5 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:5b}].tag.power


execute if score @s advm_battery_swapper_available matches 6 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:6b}].tag.power


execute if score @s advm_battery_swapper_available matches 7 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:7b}].tag.power


execute if score @s advm_battery_swapper_available matches 8 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:8b}].tag.power


execute if score @s advm_battery_swapper_available matches 9 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:9b}].tag.power


execute if score @s advm_battery_swapper_available matches 10 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:10b}].tag.power


execute if score @s advm_battery_swapper_available matches 11 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:11b}].tag.power


execute if score @s advm_battery_swapper_available matches 12 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:12b}].tag.power


execute if score @s advm_battery_swapper_available matches 13 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:13b}].tag.power


execute if score @s advm_battery_swapper_available matches 14 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:14b}].tag.power


execute if score @s advm_battery_swapper_available matches 15 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:15b}].tag.power


execute if score @s advm_battery_swapper_available matches 16 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:16b}].tag.power


execute if score @s advm_battery_swapper_available matches 17 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:17b}].tag.power


execute if score @s advm_battery_swapper_available matches 18 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:18b}].tag.power


execute if score @s advm_battery_swapper_available matches 19 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:19b}].tag.power


execute if score @s advm_battery_swapper_available matches 20 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:20b}].tag.power


execute if score @s advm_battery_swapper_available matches 21 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:21b}].tag.power


execute if score @s advm_battery_swapper_available matches 22 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:22b}].tag.power


execute if score @s advm_battery_swapper_available matches 23 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:23b}].tag.power


execute if score @s advm_battery_swapper_available matches 24 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:24b}].tag.power


execute if score @s advm_battery_swapper_available matches 25 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:25b}].tag.power


execute if score @s advm_battery_swapper_available matches 26 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:26b}].tag.power


execute if score @s advm_battery_swapper_available matches 27 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:27b}].tag.power


execute if score @s advm_battery_swapper_available matches 28 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:28b}].tag.power


execute if score @s advm_battery_swapper_available matches 29 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:29b}].tag.power


execute if score @s advm_battery_swapper_available matches 30 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:30b}].tag.power


execute if score @s advm_battery_swapper_available matches 31 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:31b}].tag.power


execute if score @s advm_battery_swapper_available matches 32 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:32b}].tag.power


execute if score @s advm_battery_swapper_available matches 33 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:33b}].tag.power


execute if score @s advm_battery_swapper_available matches 34 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:34b}].tag.power


execute if score @s advm_battery_swapper_available matches 35 store result storage advm:temp swap_power int 1 run data get entity @s Inventory[{Slot:35b}].tag.power

execute if score @s advm_battery_swapper_available matches 0.. run item modify entity @s weapon.offhand advm:set_swapper_power

execute as @s[nbt={Inventory:[{Slot:0b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 0 run loot replace entity @s container.0 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:0b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 0 run item modify entity @s container.0 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:1b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 1 run loot replace entity @s container.1 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:1b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 1 run item modify entity @s container.1 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:2b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 2 run loot replace entity @s container.2 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:2b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 2 run item modify entity @s container.2 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:3b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 3 run loot replace entity @s container.3 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:3b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 3 run item modify entity @s container.3 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:4b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 4 run loot replace entity @s container.4 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:4b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 4 run item modify entity @s container.4 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:5b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 5 run loot replace entity @s container.5 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:5b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 5 run item modify entity @s container.5 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:6b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 6 run loot replace entity @s container.6 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:6b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 6 run item modify entity @s container.6 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:7b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 7 run loot replace entity @s container.7 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:7b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 7 run item modify entity @s container.7 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:8b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 8 run loot replace entity @s container.8 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:8b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 8 run item modify entity @s container.8 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:9b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 9 run loot replace entity @s container.9 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:9b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 9 run item modify entity @s container.9 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:10b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 10 run loot replace entity @s container.10 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:10b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 10 run item modify entity @s container.10 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:11b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 11 run loot replace entity @s container.11 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:11b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 11 run item modify entity @s container.11 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:12b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 12 run loot replace entity @s container.12 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:12b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 12 run item modify entity @s container.12 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:13b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 13 run loot replace entity @s container.13 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:13b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 13 run item modify entity @s container.13 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:14b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 14 run loot replace entity @s container.14 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:14b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 14 run item modify entity @s container.14 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:15b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 15 run loot replace entity @s container.15 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:15b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 15 run item modify entity @s container.15 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:16b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 16 run loot replace entity @s container.16 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:16b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 16 run item modify entity @s container.16 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:17b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 17 run loot replace entity @s container.17 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:17b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 17 run item modify entity @s container.17 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:18b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 18 run loot replace entity @s container.18 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:18b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 18 run item modify entity @s container.18 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:19b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 19 run loot replace entity @s container.19 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:19b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 19 run item modify entity @s container.19 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:20b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 20 run loot replace entity @s container.20 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:20b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 20 run item modify entity @s container.20 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:21b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 21 run loot replace entity @s container.21 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:21b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 21 run item modify entity @s container.21 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:22b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 22 run loot replace entity @s container.22 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:22b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 22 run item modify entity @s container.22 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:23b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 23 run loot replace entity @s container.23 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:23b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 23 run item modify entity @s container.23 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:24b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 24 run loot replace entity @s container.24 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:24b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 24 run item modify entity @s container.24 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:25b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 25 run loot replace entity @s container.25 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:25b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 25 run item modify entity @s container.25 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:26b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 26 run loot replace entity @s container.26 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:26b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 26 run item modify entity @s container.26 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:27b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 27 run loot replace entity @s container.27 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:27b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 27 run item modify entity @s container.27 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:28b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 28 run loot replace entity @s container.28 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:28b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 28 run item modify entity @s container.28 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:29b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 29 run loot replace entity @s container.29 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:29b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 29 run item modify entity @s container.29 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:30b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 30 run loot replace entity @s container.30 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:30b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 30 run item modify entity @s container.30 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:31b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 31 run loot replace entity @s container.31 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:31b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 31 run item modify entity @s container.31 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:32b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 32 run loot replace entity @s container.32 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:32b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 32 run item modify entity @s container.32 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:33b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 33 run loot replace entity @s container.33 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:33b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 33 run item modify entity @s container.33 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:34b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 34 run loot replace entity @s container.34 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:34b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 34 run item modify entity @s container.34 advm:set_amount

execute as @s[nbt={Inventory:[{Slot:35b,tag:{id:"advm:battery",chargeable:0b}}]}] if score @s advm_battery_swapper_available matches 35 run loot replace entity @s container.35 loot advm:battery_used_up
data modify storage advm:temp amount set value 0
execute as @s[nbt={Inventory:[{Slot:35b,tag:{id:"advm:battery",chargeable:1b}}]}] if score @s advm_battery_swapper_available matches 35 run item modify entity @s container.35 advm:set_amount
scoreboard players set @s advm_battery_swapper_available -1